package com.example.app.controller

import com.example.app.bean.KL8
import com.example.app.dao.KL8Repository
import com.example.app.service.Api
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping(value = ["/api"])
class ApiController {

    @Autowired
    internal var api: Api? = null

    @Autowired
    var klRepository: KL8Repository? = null

    @GetMapping("/kl/list")
    fun klall(): List<KL8>? {
        return klRepository!!.findAll()
    }

    @GetMapping("/caipiao/query/equals/3")
    fun equals(num: Int): List<KL8>? {
        return api!!.equalsThree(num)
    }

    @GetMapping("/caipiao/query/equals")
    fun equal(num: Int): List<KL8>? {
        return api!!.equalQuery(num)
    }

    @GetMapping("/caipiao/search")
    fun search(s: String): List<KL8>? {
        return api!!.search(s)
    }

    @GetMapping("/caipiao/check/fs")
    fun checkFs10(): String {
        return api!!.checkFs10()
    }
    @GetMapping("/caipiao/check/other")
    fun other(): String {
        return api!!.checkOther()
    }

    @GetMapping("/caipiao/check/zj")
    fun checkZj(s: Int): String {
        return api!!.checkZj(s)
    }
}